package com.qf.picknamemybaties.servlet;

import com.qf.picknamemybaties.dao.NameDao;
import com.qf.picknamemybaties.utils.MybatiesUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/reset")
public class ResetServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf-8");
        NameDao nameDao = MybatiesUtils.getMapper(NameDao.class);
        nameDao.resetAll();
        MybatiesUtils.commit();
        resp.getWriter().print("已重置");
    }
}
